package exam.controller;

import exam.pojo.User;
import exam.service.UserService;

import java.sql.SQLException;
import java.util.List;

public class UserController {

    UserService ps = new UserService();

    public void testInsert(){

        User person1 = new User(
                1,
                "tom",
                "123",
                "工人",
                2000
        );

        boolean result = ps.insert(person1);

    }

    public void testUpdate(){

        User person = new User(
                1,
                "tom",
                "工人",
                "12345",
                2000
        );

        boolean result = ps.update(person);
    }

    public void testDelete(){

        User person = new User(
                1,
                "tom",
                "工人",
                "12345",
                2000
        );

        String[] str = new String[1];

        str[0] = person.getUserName();

        boolean result = ps.delete(str);
    }

    public void testSelect() throws SQLException {

        List<User> result = ps.getAll();
        System.out.println(result);
    }


    public static void main(String[] args) throws SQLException {
        UserController pc = new UserController();
        //pc.testInsert();
        //pc.testUpdate();
        //pc.testDelete();
        //pc.testSelect();

    }
}
